

.PHONY: help install WSW/swuch.exe WSW/symmlink.exe test

WSW/swuch.exe: 
	perl make.pl

test:
	cd WSW
	swuch
	cd ..

help: 
	@echo if you need help, maybe you shouldn\'t use it 


VERS=$(shell perl -n -e 's/.*\bVERSION\s*=\s*(\d+).*/\1/ and print ' Swuch/CheckUpdates.pm)
HTDOC=/emc/sgdb/www/htdocs/swuch
install:
	chmod 755 WSW/*
	cp WSW/swuch.exe            Srvr/sw-up/
	cp $(HTDOC)/swuch.exe	    WSW/swuch.exe.back
	cp WSW/swuch.exe	    $(HTDOC)/
	cp $(HTDOC)/SwucH.setup.exe WSW/SwucH.setup.exe.back
	cp WSW/SwucH.setup.exe      $(HTDOC)/
	cp $(HTDOC)/symmlink.exe    WSW/symmlink.exe.back
	cp WSW/symmlink.exe	    $(HTDOC)/
	# cp $(HTDOC)/swuch.linux.bin WSW/swuch.linux.bin.back
	# cp WSW/swuch.linux.bin      $(HTDOC)/
	echo $(VERS) > $(HTDOC)/S_VERSION 


inno:
	"c:/program Files/Inno Setup 5/ISCC.exe" WSW/swuch.iss

it: all symmlink inno public

all: WSW/swuch.exe 

SPERL=WSW/swuchperl.exe
sperl:
	rm $(SPERL).back || ls -d
	mv $(SPERL) $(SPERL).back || ls -d 
	perlapp.exe --freestanding --nologo --clean --c --icon=3.ico --script sperl.pl --exe $(SPERL)

swuchperl: sperl

SPERLD=WSW/swuchperl-debug.exe
sperld:
	rm $(SPERLD).back || ls -d
	mv $(SPERLD) $(SPERLD).back || ls -d 
	perlapp.exe --freestanding --nologo --clean --c --icon=3.ico --script sperl.pl --debug - --exe $(SPERLD) --verbose --add='Term::ReadLine::Perl'

SPERLTK=WSW/swuchperltk.exe
sperltk:
	rm $(SPERLTK).back || ls -d
	mv $(SPERLTK) $(SPERLTK).back || ls -d 
	perlapp.exe --freestanding --nologo --clean --c --icon=3.ico --script sperltk.pl --exe $(SPERLTK)

swuchperltk: sperltk

isdoc:
	perl -MPod::Html -e "pod2html '--outfile=swuchperl.pod.html', '--title=swuchperl POD' , 'SWUCH.pm', 'Swuch/Syscalls.pm' "
	cp $(HTDOC)/swuchperl.pod.html $(HTDOC)/swuchperl.pod.html.back
	cp swuchperl.pod.html $(HTDOC)/swuchperl.pod.html


isperl: isdoc
	chmod 755 WSW/*
	cp $(HTDOC)/swuchperl.exe   WSW/swuchperl.exe.back
	cp WSW/swuchperl.exe        $(HTDOC)/

WSW/symmlink.exe:
	perl make.pl symmlink

symmlink: WSW/symmlink.exe

loader: bin/mboxloader.pl
	perl make.pl mboxloader

public:
	cp WSW/*.exe //starfleet/eng/sgdb/swuch